//
//  AAWLog.m
//  Cubefetti
//
//  Created by David Wagner on 24/06/2009.
//  Copyright 2009 Zygote Commando. All rights reserved.
//

#import "AAWLog.h"

static UILabel* outputLabel = nil;

void logToLabel( NSString* message )
{
	[outputLabel setText:message];
}

void AAWLogSetOutputLabel( UILabel* label )
{
	[outputLabel autorelease];
	outputLabel = [label retain];
}

void AAWLog( NSString* message, ... )
{
	va_list args;
    va_start (args, message);
	
    if (![message hasSuffix: @"\n"])
	{
		message = [message stringByAppendingString: @"\n"];
    }
	
    NSString* body = [[NSString alloc] initWithFormat: message arguments: args];
	
	logToLabel( body );

    va_end (args);
    [body release];
}
